import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import './plugins/element.js'

import axios from "axios"
//将axios挂载到$http
Vue.prototype.$http = axios;

import './plugins/vant.js'
import vuetify from './plugins/vuetify';

import './plugins/iview.js'




axios.defaults.baseURL = '/api' //关键代码


Vue.config.productionTip = false

router.beforeEach((to, from, next) => {
	if (to.meta.requireAuth) {
		if (localStorage.getItem("userId")) {
			console.log("验证成功");
			
			next();
		} else {
			alert("没有登录账号。。。请先登录账号")
			next({
				
				path: "/index",
				query: {
					redirect: to.fullPath
				}
			})
		}
	} else {
		next();
	}

})


new Vue({
	router,
	store,
	vuetify,
	render: h => h(App)
}).$mount('#app')
